﻿<UserControl x:Class="BaffoHat.Wpf.Controls.KinectCursor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:ec="clr-namespace:Microsoft.Expression.Controls;assembly=Microsoft.Expression.Controls"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300"
             IsHitTestVisible="False"
             DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../Skins/CursorStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <Storyboard x:Key="PART_HoverStoryboard">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(ec:PathListBox.LayoutPaths)[0].(ec:LayoutPath.Span)"
                                               Storyboard.TargetName="pathListBox">
                    <EasingDoubleKeyFrame KeyTime="0:0:1"
                                          Value="1" />
                    <EasingDoubleKeyFrame KeyTime="0:0:1.1"
                                          Value="0" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                               Storyboard.TargetName="pathListBox">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                          Value="1" />
                    <EasingDoubleKeyFrame KeyTime="0:0:1"
                                          Value="1" />
                    <EasingDoubleKeyFrame KeyTime="0:0:1.1"
                                          Value="1" />
                </DoubleAnimationUsingKeyFrames>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                               Storyboard.TargetName="pathListBox">
                    <DiscreteObjectKeyFrame KeyTime="0"
                                            Value="{x:Static Visibility.Visible}" />
                    <DiscreteObjectKeyFrame KeyTime="0:0:1"
                                            Value="{x:Static Visibility.Hidden}" />
                    <DiscreteObjectKeyFrame KeyTime="0:0:1.1"
                                            Value="{x:Static Visibility.Hidden}" />
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </ResourceDictionary>
    </UserControl.Resources>

    <Canvas>
        <ec:PathListBox x:Name="pathListBox"
                        HorizontalAlignment="Left"
                        Height="0"
                        VerticalAlignment="Top"
                        Width="0"
                        WrapItems="True"
                        Opacity="0">
            <ec:PathListBox.LayoutPaths>
                <ec:LayoutPath SourceElement="{Binding ElementName=ListBoxPath}"
                               Distribution="Even"
                               Padding="0"
                               Orientation="OrientToPath"
                               Start="-0.22"
                               Span="0" />
            </ec:PathListBox.LayoutPaths>

            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
            <Path Style="{StaticResource WaitCursorAnimatedPathStyle}" />
        </ec:PathListBox>

        <Grid x:Name="PART_Cursor">
            <Grid Margin="-50,-50,0,0"
                  x:Name="WaitCursor"
                  Visibility="Collapsed">
                <Ellipse x:Name="ListBoxPath"
                         Width="90"
                         Height="90" />

                <Ellipse Style="{StaticResource WaitCursorBasisEllipseStyle}"
                         Width="100"
                         Height="100" Opacity="0.6" />

                <Path Style="{StaticResource WaitCursorHandStyle}"
                      Fill="{StaticResource WaitCursorHandShadowBrush}">
                    <Path.Effect>
                        <BlurEffect />
                    </Path.Effect>
                </Path>

                <Path Fill="{StaticResource CursorFillBrush}"
                      Style="{StaticResource WaitCursorHandStyle}" />
            </Grid>

            <Grid Height="118.985"
                  Width="98.61"
                  Margin="-64,-74,0,0"
                  x:Name="DrawCursor">
                <Path Fill="{StaticResource DrawingCursorHandShadowBrush}"
                      Style="{StaticResource DrawingCursorHandStyle}"
                      OpacityMask="{x:Null}">
                    <Path.Effect>
                        <BlurEffect Radius="11" />
                    </Path.Effect>
                </Path>

                <Path Style="{StaticResource DrawingCursorHandStyle}">
                    <Path.OpacityMask>
                        <RadialGradientBrush GradientOrigin="0.696,0.7">
                            <GradientStop Color="#A9000000"
                                          Offset="0.025" />
                            <GradientStop Color="White"
                                          Offset="1" />
                        </RadialGradientBrush>
                    </Path.OpacityMask>
                </Path>

                <Ellipse Style="{StaticResource DrawingCursorCenterPointStyle}"
                         x:Name="PART_TEMPO" />
            </Grid>
        </Grid>
    </Canvas>
</UserControl>
